package com.iris.lock;

/**
 * @author : Iris.Xiao
 * @date : 2018/03/21 14:52
 * @description :
 */
public class DeadLockMain {

    public static void main(String[] args) {
        LockObject lockObjectA = new LockObject();
        LockObject lockObjectB = new LockObject();
        LockObject lockObjectC = new LockObject();
        LockObject lockObjectD = new LockObject();
        lockObjectA.setSonObject(lockObjectB);
        lockObjectB.setSonObject(lockObjectC);
        lockObjectC.setSonObject(lockObjectD);
        lockObjectD.setSonObject(lockObjectA);
        DeadLock deadLockA = new DeadLock(lockObjectA);
        DeadLock deadLockB = new DeadLock(lockObjectB);
        DeadLock deadLockC = new DeadLock(lockObjectC);
        DeadLock deadLockD = new DeadLock(lockObjectD);
        new Thread(deadLockA,"deadLockA").start();
        new Thread(deadLockB,"deadLockB").start();
        new Thread(deadLockC,"deadLockC").start();
        new Thread(deadLockD,"deadLockD").start();

    }
}
